﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>StringCaseSense - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The StringCaseSense function determines whether string comparisons are case sensitive (default is &quot;not case sensitive&quot;)." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>StringCaseSense</h1>

<p>Determines whether string comparisons are case sensitive (default is &quot;not case sensitive&quot;).</p>

<pre class="Syntax"><span class="func">StringCaseSense</span> OnOffLocale</pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>OnOffLocale</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a>或<a href="../Concepts.htm#boolean">整数(布尔值)</a></p>
    <p>下列值之一:</p>
    <p><strong>On</strong> or <strong>1</strong> (true): String comparisons are case sensitive. This setting also makes the <a href="../Variables.htm#equal">expression equal sign operator (=)</a> and the case-insensitive mode of <a href="InStr.htm">InStr</a> use the <em>locale</em> method described below.</p>
    <p><strong>Off</strong> or <strong>0</strong> (false): The letters A-Z are considered identical to their lowercase counterparts. This is the starting default for all scripts due to backward compatibility and performance (<em>Locale</em> is 1 to 8 times slower than <em>Off</em> depending on the nature of the strings being compared).</p>
    <p id="Locale"><strong>Locale</strong> String comparisons are case <strong>in</strong>sensitive according to the rules of the current user's locale. 例如, most English and Western European locales treat not only the letters A-Z as identical to their lowercase counterparts, but also ANSI letters like &Auml; and &Uuml; as identical to theirs.</p>
  </dd>

</dl>

<h2 id="Remarks">备注</h2>
<p>This setting applies to:</p>
<ul>
  <li><a href="../Variables.htm#equal">Expression comparison operators</a> (except ==). However, since the <a href="../Variables.htm#equal">equal-sign operator (=)</a> is always case-insensitive, it uses the <em>Locale</em> mode when <em>StringCaseSense</em> is <em>On</em>, as does the case-insensitive mode of <a href="InStr.htm">InStr</a>.</li>
  <li><a href="InStr.htm">InStr</a>. However, it is not affected when its <em>CaseSensitive</em> parameter is <em>true</em>.</li>
  <li><a href="StrReplace.htm">StrReplace</a></li>
</ul>
<p>The built-in variable <strong>A_StringCaseSense</strong> contains the current setting (the word On, Off, or Locale).</p>
<p>每个新运行的<a href="../misc/Threads.htm">线程</a>(如 <a href="../Hotkeys.htm">热键</a>, <a href="../objects/Menu.htm">自定义菜单项</a>或<a href="SetTimer.htm">定时</a>子程序) 都会以此函数的默认设置开始. 这个默认设置可以通过在脚本的自动执行段(脚本的顶部) 使用此函数来改变.</p>
<h2 id="Related">相关</h2>
<p><a href="StrReplace.htm">StrReplace</a>, <a href="InStr.htm">InStr</a></p>
<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>StringCaseSense "Locale"</pre>
</div>

</body>
</html>